package com.zqu.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import java.util.Random;

public class Md5Util {
    //参数1:输入明文密码
    public static String  getMd5Code(String password){
        MessageDigest md5 = null;
        try {
            md5 = MessageDigest.getInstance("md5");
        return Base64.getEncoder().encodeToString(md5.digest(password.getBytes()));
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return null;
        }
    }

    public static void main(String[] args) {
        System.out.println(getMd5Code("123456"));
    }


}



